$(document).ready(function(){
	/*---News slider---*/
	var newsNumb = $('.news_overview li').length;
	if(newsNumb<=1){
		newsSlider = 'off';
	};
	newsBegin();
	
	$('.news_overview').hover(
		function(){clearInterval(intervalNews)},
		function(){if (newsSlider=='on'){intervalNews = setInterval("newsNext()",2000);}}
	);

});

//***** NEWS SLIDER FUNCTIONS *****				
var intervalNews;
var newsOut = 6000; //pause time for slideshow in miliseconds
var newsSlider = 'on'; //turn on/off slideshow
var newsSpacer = 390; //space width for slide including margins and paddings		
		
function newsBegin(){
	$('.news_overview li').css({
		'position':'absolute',
		'top':'15px'
	});
	adjustNewsPos();
	if (newsSlider=='on'){intervalNews = setInterval("newsNext()",newsOut);}
};

function adjustNewsPos(){
	var newsNumb = $('.news_overview li').length;
	for (var i=0;i<newsNumb;i++){
		$('.news_overview li').eq(i).css({'left': (15+i*newsSpacer)+'px'})  
	};
	$('.news_overview li:nth-child(2n+3)').css('margin-left','15px');
	$('.news_overview li:nth-child(1)').css('margin-left','0');
};

/*function newsNext(){
	clearInterval(intervalNews);
	var newsSet = $('.news_overview li:eq(0), .news_overview li:eq(1)');
	newsMove = newsSpacer*2;
	$('.news_overview li').animate({'left':'-='+newsMove+'px'},400,function(){
		$('.news_overview li:last').after(newsSet);
		adjustNewsPos();
	});
	if (newsSlider=='on'){intervalNews = setInterval("newsNext()",newsOut);}	
};*/
function newsNext(){
	clearInterval(intervalNews);
	var newsSet = $('.news_overview li:eq(0), .news_overview li:eq(1)');
	newsMove = newsSpacer*2;
	$('.news_overview li').css({'left':'-='+newsMove+'px'});
	$('.news_overview li:last').after(newsSet);
	adjustNewsPos();
	if (newsSlider=='on'){intervalNews = setInterval("newsNext()",newsOut);};	
};